/**
 * 监控页面定位的浮动元素，停止滚动的时候显示，开始滚动就隐藏
 */
import Vue from 'vue';

let touchend = el => {
  el.classList.remove('fixed-float-zoomOut');
  el.classList.add('fixed-float-zoomIn');
};

let touchmove = el => {
  el.classList.remove('fixed-float-zoomIn');
  el.classList.add('fixed-float-zoomOut');
};

Vue.directive('fixed-float', {
  inserted (el) {
    let square = document.querySelector('.page-main');
    square.addEventListener('touchend', ()=>touchend(el), false);
    square.addEventListener('touchmove', ()=>touchmove(el), false);
  }
});
